package org.utils.util;

//import org.apache.log4j.Logger;

/**
 * @author Mektoub
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class ObjectDumper
{
	private static final String newLine = System.getProperty("line.separator");

	private StringBuffer buffer = null;
	private String separator = ": ";
	/**
	 * Constructor for ToStringUtils.
	 */
	public ObjectDumper()
	{
		this(null);
	}
	/**
	 * Constructor for ToStringUtils.
	 */
	public ObjectDumper(StringBuffer s)
	{
		super();
		if (s == null)
		    buffer = new StringBuffer();
		else
		    buffer = s;
	}

	public ObjectDumper append(String name, Object value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, Object value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper append(String name, int value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, int value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper append(String name, long value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, long value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper append(String name, char value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, char value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper append(String name, short value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, short value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper append(String name, float value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, float value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper append(String name, double value)
	{
		buffer.append(name).append(separator).append(value);
		return this;
	}

	public ObjectDumper appendln(String name, double value)
	{
		return append(name, value).newLine();
	}

	public ObjectDumper newLine()
	{
		buffer.append(newLine);
		return this;
	}

	public String toString()
	{
		return buffer.toString();
	}
	/**
	 * Method getStringBuffer.
	 * @return StringBuffer
	 */
	public StringBuffer getStringBuffer()
	{
		return buffer;
	}
}
